package cn.com.wxUtil.template;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import org.springframework.boot.autoconfigure.amqp.RabbitProperties.Template;

import com.alibaba.fastjson.JSONObject;

import cn.com.wxUtil.wxConstant;

public class TestClass {
	public static void main(String[] args) {
		String openid="OPEN_ID";
		String prepay_id = "PREPAY_ID";
		String time = "2018-10-04 00:00:00";
		String total_fee = "111";
		String phone = "13888888888";
		String userName = "马徐前";
		String addressString="天津红桥";
		WechatTemplate w = new WechatTemplate();
		w.setTouser(openid);
		w.setForm_id(prepay_id);
		w.setTemplate_id(wxConstant.TEMPLATE_ID_PAY);
		LinkedHashMap<String,TemplateData> map = new LinkedHashMap<>();
		TemplateData t1 = new TemplateData();
		t1.setValue(time);
		t1.setColor("#000000");
		map.put("支付时间", t1);
		TemplateData t2 = new TemplateData();
		t2.setValue(total_fee);
		t2.setColor("#000000");
		map.put("支付金额", t2);
		TemplateData t3 = new TemplateData();
		t3.setValue(phone);
		t3.setColor("#000000");
		map.put("联系人手机号", t3);
		TemplateData t4 = new TemplateData();
		t4.setValue(userName);
		t4.setColor("#000000");
		map.put("联系人姓名", t4);
		TemplateData t5 = new TemplateData();
		t5.setValue(addressString);
		t5.setColor("#000000");
		map.put("地址", t5);
		w.setData(map);
		String jsonTemplate = JSONObject.toJSON(w).toString();
		System.out.println(jsonTemplate);
	}
}
